package com.ybg.engine.mail;

import org.springframework.jdbc.core.JdbcTemplate;

import com.ybg.util.LogUtil;

public class MailUtil {
	
	MailInfo mailInfo = new MailInfo();
	static IMailSender iMailSender;
	
	public static void sendMail(JdbcTemplate jdbcTemplate,String from,String to,String subject,String content){
		iMailSender = new SimpleMailSenderImpl(jdbcTemplate);
		if(subject == null || subject.length() == 0||
				content == null || content.length() == 0){
			LogUtil.error("subject and content must not be  EMPTY !");
		}
		if(iMailSender.sendMail(from, to, subject, content)){
			LogUtil.info("send mail sucess");
		}else{
			LogUtil.error("failed in send mail ! ,main subject : {} ,main content : {}",subject,content);
		}
	}
}